
from MySQLGenerator import MySQLGenerator
from Config import DB_CONFIG

def main():
    """主函数"""
    # 检查配置
    if not DB_CONFIG['database']:
        print("错误: 请在config.py中设置要连接的数据库名")
        return
    # 创建生成器实例
    generator = MySQLGenerator()
    # 连接数据库
    if not generator.connect():
        return
    try:
        # 生成类
        generator.generate_classes()
    finally:
        # 断开连接
        generator.disconnect()

if __name__ == '__main__':
    main()
